Missing returns for Node.{insertBefore, appendChild, replaceChild, removeChild}#15
Merged
developit merged 3 commits intodevelopit:masterfrom Jan 22, 2018
andyrj:master
Merged
Missing returns for Node.{insertBefore, appendChild, replaceChild, removeChild}#15developit merged 3 commits intodevelopit:masterfrom andyrj:master
developit merged 3 commits intodevelopit:masterfrom
andyrj:master
Conversation
developit
reviewed
Oct 2, 2017
| child.parentNode = this; | ||
| if (!ref) this.childNodes.push(child); | ||
| else splice(this.childNodes, ref, child); | ||
| !ref ? this.childNodes.push(child) : splice(this.childNodes, ref, child); |
Owner
There was a problem hiding this comment.
I think this is pretty much what Uglify does (haven't checked).
Contributor
Author
There was a problem hiding this comment.
Eslint complained when I simply added return after the if/else as it thought the return was only for the else case. So I switched to the ternary.
Contributor
Author
There was a problem hiding this comment.
Not that changing simply because eslint says so is the right thing, but in this case it does seem to make things clearer with the ternary imo.
|
Bump! I'd love to see this merged and released soon! |
Contributor
Author
|
@developit Is there any chance this will be merged? I'd prefer to avoid publishing a fork to npm just for these return statements. 😞 |
Owner
|
Sorry about the super slow response! I'm merging. |
developit
approved these changes
Jan 22, 2018
|
Thanks @developit !! 🎉 |
Contributor
Author
|
@developit Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To match actual dom api these calls need to return the nodes added or removed.
https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild
Was there a reason for leaving off these returns? Ran into this using undom with hyperapp.